package com.example.java_chatroom.demo;

import java.sql.Array;
import java.util.ArrayList;

class MyArray1<T> {
    private T[] array = (T[]) new Object[10];

    public void setArray(int pos, T val) {
        array[pos] = val;
    }

    public T getArray(int pos) {
        return array[pos];
    }
}

public class Demo05 {

    public static void main(String[] args) {
        MyArray1<Integer> myArray1 = new MyArray1<Integer>();
        myArray1.setArray(0,0);
        myArray1.setArray(1,1);
        System.out.println(myArray1.getArray(1));

        MyArray1<String> myArray2 = new MyArray1<String>();
        myArray2.setArray(0,"asd");
        myArray2.setArray(1,"zrj");
        System.out.println(myArray2.getArray(1));

    }
}
